<%@ page import="java.util.ArrayList" %>
<%@ page import="entity.Monster" %><%--
  Created by IntelliJ IDEA.
  User: LMY
  Date: 2025/6/21
  Time: 17:17
  To change this template use File | Settings | File Templates.
--%>
<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<html>
  <head>
      <title>代码脚本</title>
  </head>

  <body>
  <%
    //创建list，放入monster对象
    ArrayList<Monster> list = new ArrayList<>();
    list.add(new Monster(1, "牛魔王", "芭蕉扇"));
    list.add(new Monster(2, "蜘蛛精", "吐口水"));
  %>

  <table bgcolor="#faebd7" border="7px" width="300px">
    <tr>
      <th>id</th>
      <th>名字</th>
      <th>技能</th>
    </tr>
    <%
      for (int i = 0; i < list.size(); i++) {
        //先取出monster对象
        Monster monster = list.get(i);
    %>
            <tr>
              <th><%=monster.getId()%></th>
              <th><%=monster.getName()%></th>
              <th><%=monster.getSkill()%></th>
            </tr>
        <%
      }
    %>

  </table>
  </body>
</html>
